<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="app">
    {{message}}<br/>
    <input type="text" v-model="message">
    <input @click="example" type="button" value="点击">
</div>
</div>
<script>
    var vm = new Vue({
        el: "#app",
        data: {
            message: "ok"
        },
        methods: {
            example: function () {
                // 修改数据
                this.message = 'changed'
                // DOM 还没有更新
                setTimeout(() => {
                    this.$nextTick(function () {
                        // DOM 现在更新了
                        // `this` 绑定到当前实例
                        this.message = '已经更新'
                    })
                }, 3000)
                ;
            }
        }
    });

</script>

</body>
</html>
